var rp = require('request-promise')

var yzmHelper = {
    decode: function (img, cb, codetype) {
        if (codetype == undefined)
            codetype = '1902'
        var result
        var opts = {
            url: 'http://upload.chaojiying.net/Upload/Processing.php',
            method: 'POST',
            formData: {
                user: 'doubleL',
                pass: '123456',
                softid: '893051',
                codetype: codetype,
                file_base64: img
            }
        }
        rp(opts).then(function (body) {
            cb(body)
        })
    }
}

module.exports = yzmHelper
